<template>
  <wh-table :tableData="tableData" :tableHeader="tableHeader" :tableLoading="tableLoading"></wh-table>
</template>
<script>
  import whTable from '@/components/wh-table/index.vue'
  export default {
    name:'innerMac',
    props:['workLineType'],
    data(){
      return{
        tableData: [],
        tableHeader:[],
        tableLoading:true
      }
    },
    components:{
      whTable
    },
    mounted(){
      this.setTableHeader();
      this.getUserWorks();

    },
    methods:{
      getUserWorks(){
        let self = this;
        self.$http({
          url: "/autoMonitor/workLine/queryLookProduce",
          method: "post",
          params:{workLineType:self.workLineType}
        }).then(resp => {
          if (resp.success) {
            self.tableData = resp.result;
            self.tableLoading = false
          }
        });
      },

      setTableHeader(){
        let self = this;
        self.tableHeader = [
          {"columnName": "workLineName", "coloumNameCn": "线别","minWidth":"40"},
          {"columnName": "workName", "coloumNameCn": "班别","minWidth":"40"},
          {"columnName": "status", "coloumNameCn": "状态","minWidth":"40"},
          {"columnName": "", "coloumNameCn": "产量","children":[
              {"columnName": "targetOutput", "coloumNameCn": "计划","minWidth":"40"},
              {"columnName": "actualOutput", "coloumNameCn": "实际","minWidth":"40"},
              {"columnName": "disOutput", "coloumNameCn": "差额","minWidth":"40"},
            ],"minWidth":"40"
          },
          {"columnName": "", "coloumNameCn": "进度","children":[
              {"columnName": "ouputProgress", "coloumNameCn": "产量","minWidth":"40"},
              {"columnName": "spendTime", "coloumNameCn": "时间","minWidth":"40"},
            ],"minWidth":"40"
          },
          {"columnName": "", "coloumNameCn": "人员","children":[
              {"columnName": "planUserCount", "coloumNameCn": "计划","minWidth":"40"},
              {"columnName": "actualUserCount", "coloumNameCn": "实际","minWidth":"40"},
            ],"minWidth":"40"
          },
          {"columnName": "", "coloumNameCn": "线小时产出","children":[
              {"columnName": "hourOutput", "coloumNameCn": "目标","minWidth":"40"},
              {"columnName": "hourActualOutput", "coloumNameCn": "实际","minWidth":"40"},
            ],"minWidth":"40"
          },
          {"columnName": "", "coloumNameCn": "人均产出","children":[
              {"columnName": "userAverageOutput", "coloumNameCn": "目标","minWidth":"40"},
              {"columnName": "userActualOutput", "coloumNameCn": "实际","minWidth":"40"},
            ],"minWidth":"40"
          },
          {"columnName": "", "coloumNameCn": "实际停线","children":[
              {"columnName": "stopLineTime", "coloumNameCn": "目标","minWidth":"40"},
              {"columnName": "stopActualTime", "coloumNameCn": "实际","minWidth":"40"},
            ],"minWidth":"40"
          },
          {"columnName": "", "coloumNameCn": "MU","children":[
              {"columnName": "muPlan", "coloumNameCn": "目标","minWidth":"40"},
              {"columnName": "muActual", "coloumNameCn": "实际","minWidth":"40"},
            ],"minWidth":"40"
          },
          {"columnName": "", "coloumNameCn": "MTD","children":[
              {"columnName": "productive", "coloumNameCn": "目标","minWidth":"40"},
              {"columnName": "actualProductive", "coloumNameCn": "实际","minWidth":"40"},
            ],"minWidth":"40"
          },
        ];
      }
    }
  }
</script>
